home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
biblio
/
bibtex
/
utils
/
bibtools
/
makebib
(
.txt
)
< prev
next >
Wrap
LaTeX Document
|
1992-09-03
|
2KB
|
63 lines
#!/bin/csh -f
# makebib - make a bib file that has the given citations
# usage:
# makebib [-n | -d] file.bib... [citekey]...
# Where -n means "no comment", ie, don't include any "comment" fields.
# And -d means "dfk", ie, add attribution to dfk to all comment fields.
# Output is to subset.bib. If citekey is not given, then all refs in
# the bibfile are included.
onintr cleanup
if ($#argv < 1) then
echo 'usage: makebib [-n|-d] file.bib... [citekey]...'
exit 1
endif
if ("$1" == "-n") then
set bst=subset-nocomment
shift
if ("$1" == "-d") then
set bst=subset-dfk
shift
else
set bst=subset
endif
endif
if ($#argv < 1) then
echo 'usage: makebib [-n|-d] file.bib... [citekey]...'
exit 1
endif
set files = $1:r
shift
while ($1:e == "bib")
set files=($files,$1:r)
shift
echo creating subset.tex for $files
cat > subset.tex <<EOF
\documentstyle{article}
\begin{document}
if ($#argv > 0) then
foreach f ($*)
echo "\nocite{$f}" >> subset.tex
end
echo "\nocite{*}" >> subset.tex
endif
cat >> subset.tex <<EOF
\bibliographystyle{$bst}
\bibliography{$files}
\end{document}
rm -f subset.{aux,log,dvi,bbl,blg}
echo latex subset.tex
latex subset.tex
echo bibtex subset
bibtex subset
sed > subset.bib \
-e 's/\\ie/i.e./g' \
-e 's/\\eg/e.g./g' \
-e 's/\\etc/{\\em etc.}/g' \
-e 's/\\vs/{\\em vs.}/g' \
-e 's/\\usec/{{$\\mu$}sec}/g' \
subset.bbl
echo ""
echo output is in subset.bib
cleanup:
rm -f subset.{tex,aux,log,dvi,bbl,blg}